<div class="module-gop">
    <ol class="breadcrumb fn-clearfix">
        <li>市场监控</li>
        <li>{{vm.type.toUpperCase()}}</li>
        <li>Orders 挂单记录</li>
    </ol>

    <div class="panel panel-warning">
        <div class="panel-body">
            <form class="form-inline ui-form" role="form">
                <div class="form-group">
                    <select class="form-control" ng-model="vm.condition.type" ng-change="vm.fetchList()">
                        <option value="BUY">买</option>
                        <option value="SELL">卖</option>
                        <option value="" selected>全部买卖</option>
                    </select>
                </div>
                <div class="form-group">
                    <select class="form-control" ng-model="vm.condition.status" ng-change="vm.fetchList()" >
                        <option value="SUCCESS">已完成</option>
                        <option value="CANCEL">已关闭</option>
                        <option value="PROCESSING">进行中</option>
                        <option value="" selected>全部状态</option>
                    </select>
                </div>
                <div class="form-group ui-input-select">
                    <input type="text" class="form-control " placeholder="按类别搜索信息"
                           ng-model="keyWordText" >
                    <select class="form-control" ng-model="keyWord">
                        <option value="id">ID</option>
                        <option value="uId">用户ID</option>
                        <option value="account">账号</option>
                    </select>
                    <button type="submit"  class="btn btn-primary" ng-click="vm.fetchList()">搜索</button>
                </div>
            </form>
        </div>
    </div>

    <div class="ui-box">
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th width="4%">ID</th>
                <th width="4%">UID</th>
                <th width="8%">价格</th>
                <th width="5%">总量</th>
                <th width="6%">剩余量</th>
                <th width="8%">买卖</th>
                <th width="8%">状态</th>
                <th width="8%">挂单类型</th>
                <th width="12%">创建于</th>
                <th width="12%">更新于</th>
                <th width="10%">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in vm.list" ng-if="vm.isLoading === false && vm.list.length > 0">
                <td>{{item.id}}</td>
                <td ng-click="vm.searchinfo(item.uid)"><a href="javascript:void(0)">{{item.uid}}</a></td>
                <td>{{item.price}}</td>
                <td>{{item.numTotalText}}</td>
                <td>{{item.numOverText}}</td>
                <td>{{item.tradeCoinType | restOrderType}}</td>
                <td ng-class="{
                    orangetradedetail:(item.tradeCoinStatus=='PROCESSING'||item.tradeCoinStatus=='WAIT'),
                    greentradedetail:(item.tradeCoinStatus=='SUCCESS'),
                    graytradedetail:(item.tradeCoinStatus=='CANCEL'|| item.tradeCoinStatus=='CLOSED')}">
                    {{item.tradeCoinStatus | restOrderStatus}}</td>
                <td>{{item.tradeCoinFlag | restOrderFlag}}</td>
                <td>{{$root.moment(item.createDate).utc().utcOffset($root.ZONE).format('YYYY-MM-DD HH:mm:ss')}}</td>
                <td>{{$root.moment(item.updateDate).utc().utcOffset($root.ZONE).format('YYYY-MM-DD HH:mm:ss')}}</td>
                <td><a href="javascript:;" ng-click="vm.cancelOrder(item.id,item.uid)" ng-if="item.tradeCoinStatus=='PROCESSING'||item.tradeCoinStatus=='WAIT'">强制撤单</a></td>
            </tr>
            <tr class="ui-no-data" ng-if="vm.isLoading === false && (vm.list.length === 0||vm.list===null)">
                <td colspan="12">暂无数据</td>
            </tr>
            <tr class="ui-loading" ng-if="vm.isLoading === true">
                <td colspan="12">正在加载，请稍候...</td>
            </tr>
            </tbody>
        </table>

        <div class="ui-pager-box" v-if="vm.pageNum > 0">
            <ul uib-pagination
                previous-text="上一页"
                next-text="下一页"
                first-text="首页"
                last-text="尾页"
                total-items="vm.totalNum"
                ng-model="vm.condition.pageNo"
                max-size="5"
                items-per-page="vm.condition.pageSize || 10"
                align="right"
                class="pagination"
                boundary-links="true"
                ng-change="vm.pageChanged()"
                rotate="false"></ul>
        </div>
    </div>
</div>
